package za.ac.wits.elen7045.persistence.encryption;

import za.ac.wits.elen7045.persistence.exception.EncryptionException;

public abstract class EncryptorFactory {
	
	public static Encryptor getPasswordEncryptor() {
		return getPasswordEncryptor(EncryptionQuality.MEDIUM);
	}
	public static Encryptor getPasswordEncryptor(EncryptionQuality encryptionQuality) {
		try {
			if (encryptionQuality == EncryptionQuality.HIGH) {
				return new SHAEncryptor();
			} else {
				return new MD5Encryptor();
			}
		} catch (Exception e) {
			throw new EncryptionException(e);
		}
	}

	public static Encryptor getBasicEncryptor() {
		return getBasicEncryptor(EncryptionQuality.MEDIUM);
	}
	public static Encryptor getBasicEncryptor(EncryptionQuality encryptionQuality) {
		try {
			return new BasicSymmetricEncryptor();
		} catch (Exception e) {
			throw new EncryptionException(e);
		}
	}
	
}
